package com.gitee.myclouds.framework.common.exception;

import com.gitee.myclouds.framework.common.util.Strings;

import lombok.Getter;

/**
 * 业务异常类
 * 
 * @author xiongchun
 *
 */
public class BizException extends RuntimeException {

	private static final long serialVersionUID = -1030469420838093832L;

	@Getter
	private int code = -1;

	public BizException() {
	}

	public BizException(String msg) {
		super(msg);
	}

	public BizException(String messageTemplate, Object... params) {
		super(Strings.format(messageTemplate, params));
	}

	public BizException(int code, String msg) {
		super(Strings.format("code：{}，msg：{}", code, msg));
		this.code = code;
	}

	public BizException(int code, String messageTemplate, Object... params) {
		super(Strings.format("code：{}，" + messageTemplate, params));
		this.code = code;
	}
	
	public BizException(Throwable throwable) {
		super(throwable);
	}
	
	public BizException(String msg, Throwable throwable) {
		super(msg, throwable);
	}

}
